var prefix = "/album/info"
$().ready(function(){ 
	validateRule(); 
});

$.validator.setDefaults({
	submitHandler : function() {
		update();
	}
});
function update() {
	layer.load(1); 
	$.ajax({
		cache : true,
		type : "POST",
		url : prefix+"/updateLoop",
		data : $('#signupForm').serialize(),// 你的formid
		async : false,
		error : function(request) {
			layer.closeAll('loading');
			parent.layer.alert("连接异常");
		},
		success : function(data) {
			layer.closeAll('loading');
			if (data.code == 0) { 
				parent.layer.msg("操作成功");
//				parent.location.reload();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
				//window.location.href =  prefix+"/qyLoop";
				parent.location.reload();
			} else {
				parent.layer.alert(data.msg)
			}

		}
	});

}
 

function validateRule() { 
    var icon = "<i class='fa fa-times-circle'></i> ";
    $("#signupForm").validate({
    	rules : { 
            loops : {
            	required : true,
                digits : true,
                maxlength : 12 
            }  
        },
        messages : { 
            loops : {
            	required : icon + "请输入正整数",
            	digits : icon + "请输入正整数",
            	maxlength : icon + "输入值过大"
            } 
        }
    })
}
